<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>JPay-捷付</title>
</head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js"></script>
<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.inc.min.js"></script>
<body>
<button id="J_btn" class="btn btn-default">支付</button>
<script th:inline="javascript">
    // $(document).ready(function(){
    //     var tradeNO = [[${orderNo}]];
    //     AlipayJSBridge.call("tradePay", {
    //         orderStr: tradeNO
    //     }, function (data) {
    //         log(JSON.stringify(data));
    //         if ("9000" === data.resultCode) {
    //             log("支付成功");
    //         }
    //     });
    // });
    var btn = document.querySelector('#J_btn');
    btn.addEventListener('click', function(){
        var tradeNO = [[${orderNo}]];
        ap.tradePay({
            orderStr: tradeNO
        }, function(res){
            ap.alert(res.resultCode);
        });
    });
</script>
</body>
</html>
